#define _CRT_SECURE_NO_WARNINGS 1

int strStr(char* haystack, char* needle) {
    int i = 0;
    int oi = i;
    int j = 0;
    while (haystack[i] != '\0')
    {
        oi = i;
        if (haystack[i] == needle[j])
        {
            while (++j, ++oi)
            {
                if (needle[j] == '\0')
                    return i;
                if (haystack[oi] != needle[j])
                {
                    oi = 0;
                    break;
                }
            }
            if (oi)
                return i;
        }
        j = 0;
        i++;
    }
    return -1;
}